<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Open Local Camera</title>
</head>
<body>
    <h1>Open Local Camera</h1>
    <video id="video" width="640" height="480" autoplay></video>

    <script>
        // 获取视频元素
        const video = document.getElementById('video');

        // 请求访问摄像头
        navigator.mediaDevices.getUserMedia({ video: true })
            .then(function(stream) {
                // 将视频流绑定到视频元素
                video.srcObject = stream;
            })
            .catch(function(error) {
                console.error('Error accessing the camera: ', error);
            });
    </script>
</body>
</html>

